<template>
  <div>
    <div class= "banner">
      <img @click="handleBannerClick" class="banner-img" :src="bannerImg" />
      <div class="banner-info">
        <div class="banner-title">
         {{this.sightName}}
        </div>
        <div class="banner-number"><span class="iconfont">&#xe692;</span> 39</div>
      </div>
    </div>
    <common-fade>
      <common-gallary :imgs="gallaryImgs" v-show="showGallary" @close="handleBannerBack"></common-gallary>
    </common-fade>
  </div>
   <!-- 这个common-gallary就是fade组建中的插槽 -->
</template>

<script>
import CommonGallary from 'common/gallary/Gallary'
import CommonFade from 'common/fade/Fade'
export default {
  name: 'DetailBanner',
  components: {
    CommonGallary,
    CommonFade
  },
  data () {
    return {
      showGallary: false,
    }
  },
  methods: {
    handleBannerClick () {
      this.showGallary = true
    },
    handleBannerBack () {
      this.showGallary = false
    }
  },
  props: {
    sightName: String,
    bannerImg: String,
    gallaryImgs: Array
  }
}
</script>

<style lang="stylus" scoped>
  .banner
    position: relative
    overflow: hidden
    height: 0
    padding-bottom: 55%
    .banner-img
      width: 100%
    .banner-info
      display: flex
      position: absolute
      left: 0
      bottom: .05rem
      right: 0
      line-height: .6rem
      background-image: linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8))
      .banner-title
        flex: 1
        color: #fff
        margin-left: .2rem
        font-size: .32rem
      .banner-number
        padding: 0 .4rem
        color: #fff
        background: rgba(0, 0, 0, .8)
        line-height: .3rem
        height: .3rem
        border-radius: .2rem
        padding-top: .1rem
</style>